package com.stormragetech.sylwanas.test;

import com.alibaba.fastjson.JSON;
import org.springframework.amqp.support.converter.Jackson2JsonMessageConverter;

import java.lang.reflect.ParameterizedType;

/**
 * description: //TODO
 *
 * @author: Xue Bin
 * @version: 1.0.0-SNAPSHOT
 */
public class Cast<T> {

    Object cast(String json) {


        Class<? super T> rawType = (Class<T>) ((ParameterizedType) getClass().getGenericSuperclass()).getActualTypeArguments()[0];
        T t = JSON.parseObject(json, (Class<T>) rawType);
        return t;
    }

}
